package com.bluesky.common.config;

import lombok.Getter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 读取项目相关配置
 * ConfigurationProperties需要调用非静态的set方法
 *
 * @author Kevin
 */
@Component
@ConfigurationProperties(prefix = "app")
public class AppConfig {

    /**
     * 项目名称
     */
    @Getter
    private static String name;

    /**
     * 版本
     */
    @Getter
    private static String version;

    /**
     * 版权年份
     */
    @Getter
    private static String copyrightYear;

    /**
     * 实例演示开关
     */
    @Getter
    private static boolean demoEnabled;

    /**
     * 工作目录
     */
    @Getter
    private static String profile;

    /**
     * 临时目录
     */
    @Getter
    private static String tempDir;

    /**
     * 上传目录
     */
    @Getter
    private static String uploadDir;

    /**
     * 图片上传目录
     */
    @Getter
    private static String imageDir;

    /**
     * excel上传目录
     */
    @Getter
    private static String excelDir;

    /**
     * 获取地址开关
     */
    @Getter
    private static boolean addressEnabled;

    /**
     * 缓存前缀
     */
    @Getter
    private static String cachePrefix;

    /**
     * 令牌有效期
     */
    @Getter
    private static Integer expireTime;

    /**
     * server url
     */
    @Getter
    private static String serverUrl;

    public void setName(String name) {
        AppConfig.name = name;
    }

    public void setVersion(String version) {
        AppConfig.version = version;
    }

    public void setCopyrightYear(String copyrightYear) {
        AppConfig.copyrightYear = copyrightYear;
    }

    public void setDemoEnabled(boolean demoEnabled) {
        AppConfig.demoEnabled = demoEnabled;
    }

    public void setProfile(String profile) {
        AppConfig.profile = profile;
    }

    public void setTempDir(String tempDir) {
        AppConfig.tempDir = tempDir;
    }

    public void setUploadDir(String uploadDir) {
        AppConfig.uploadDir = uploadDir;
    }

    public void setImageDir(String imageDir) {
        AppConfig.imageDir = imageDir;
    }

    public void setExcelDir(String excelDir) {
        AppConfig.excelDir = excelDir;
    }

    public void setAddressEnabled(boolean addressEnabled) {
        AppConfig.addressEnabled = addressEnabled;
    }

    public void setCachePrefix(String cachePrefix) {
        AppConfig.cachePrefix = cachePrefix;
    }

    public void setExpireTime(Integer expireTime) {
        AppConfig.expireTime = expireTime;
    }

    public void setServerUrl(String serverUrl) {
        AppConfig.serverUrl = serverUrl;
    }
}
